package com.example.filepersistencetest

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_main.*
import java.io.*

class MainActivity : AppCompatActivity() , View.OnClickListener {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        btnFileIO.setOnClickListener(this)
        btnSharedPreferences.setOnClickListener(this)
        btnSQLite.setOnClickListener(this)
    }

    override fun onClick(v: View?) {
        v?.run{
            startActivity(
                when(id){
                    R.id.btnFileIO -> Intent(this@MainActivity,FileIOActivity::class.java)
                    R.id.btnSharedPreferences -> Intent(this@MainActivity,SharedPreferencesActivity::class.java)
                    R.id.btnSQLite -> Intent(this@MainActivity,SQLActivity::class.java)
                    else -> Intent(this@MainActivity,FileIOActivity::class.java)
                }
            )
        }
    }

}